package com.woniuxy.controller;

import com.woniuxy.entity.RbacManager;
import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.RbacManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @BelongsProject: java-85-course-code
 * @BelongsPackage: com.woniuxy.controller
 * @Author: LiTongMiao
 * @Date: 2022/2/21 15:28
 * @Description: TODO
 */
@RestController
@RequestMapping("/rbacManager")
public class RbacManagerController {
    @Autowired(required = false)
    RbacManagerService rbacManagerService;

    @PostMapping("findAll/{currentPage}/{pageSize}")
    public ResponseEntity findAll(@PathVariable("currentPage") int currentPage,@PathVariable("pageSize") int pageSize,@RequestBody RbacManager rbacManager){
        return rbacManagerService.findAll(currentPage,pageSize,rbacManager);
    }

    @DeleteMapping("/deleteOne/{id}")
    public ResponseEntity deleteOne(@PathVariable int id){
        return rbacManagerService.deleteOne(id);
    }
    @RequestMapping("/addOne")
    public ResponseEntity addOne(@RequestBody RbacManager rbacManager){
        return rbacManagerService.addOne(rbacManager);
    }
    @RequestMapping("/edit")
    public ResponseEntity editOne(@RequestBody RbacManager rbacManager) {
        System.out.println(rbacManager);
        return rbacManagerService.editOne(rbacManager);
    }
}
